<script setup>
import {ref,reactive,onBeforeMount} from 'vue'
import getUserById from '../api/getUserById.js';
import getImage from '../api/getImage.js';

const props =  defineProps({
    value:String
})
const imageValue = ref("")
const user = ref({})
onBeforeMount(()=>{
    if (props.value!=null){
        getUserById(props.value).then((res)=>{
            if(res.status == 200)
            {
                user.value = res.data
                getImage(user.value.imageId).then((res)=>
                {
                    if(res.status == 200)
                    imageValue.value = res.data 
                })
            }
        })
    }
})

</script>

<template>
    <el-avatar class="image-box" shape="square" :size="50" :src="imageValue" />
</template>

<style>
</style>